#!/usr/bin/env python

from banner_class import Banner


def banner_fetch ( liwe, container = None ):
	"""
	:INPUT:

		- container:			SAFE_DB_STRING
	"""

	b = Banner ( liwe )
	banner = b.banner_fetch ( container )

	return { "banner": banner }


def banner_click ( liwe, id_banner ):
	"""
	:INPUT:

		- id_banner:			SAFE_DB_INTEGER
	"""
	
	b = Banner ( liwe )
	b.banner_click ( id_banner )

	banner = b.banner_get ( id_banner )

	liwe.pyhp.set_header ( "Location", banner [ "url_click" ] )

	liwe.err_code = -1
	liwe.pyhp.return_code = "302 Redirect"
